﻿<controls:ChildWindow x:Class="Locator.Silverlight.Client.ManageProducts"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           xmlns:converters="clr-namespace:Locator.Silverlight.Client.Converters"
                      xmlns:client="clr-namespace:Locator.Silverlight.Client"
           Width="800" Height="600" 
           Title="Manage Your Products" >
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
    <client:ManageProductsControl HorizontalAlignment="Center" ></client:ManageProductsControl>
        <Button Content="Close" Height="23" HorizontalAlignment="Left" Margin="695,530,0,0" Name="buttonClose" Click="CloseButton_Click" VerticalAlignment="Top" Width="75" />
    </Grid>
    <!--<ContentControl.Resources>
        <converters:AddButtonStateConverter x:Key="AddButtonStateConverter"/>
        <converters:AddButtonContentConverter x:Key="AddButtonContentConverter"/>
        <DataTemplate x:Name="ProductTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name}" Width="400" VerticalAlignment="Center" />
                <Button Content="Remove" Width="55" Command="{Binding ManageProductsViewModel.RemoveProductCommand, Source={StaticResource Locator}}" CommandParameter="{Binding}"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Name="NewProductTemplate">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name}" Width="400" VerticalAlignment="Center" />
                <Button Content="{Binding UsedByUser, Converter={StaticResource AddButtonContentConverter}}" IsEnabled="{Binding UsedByUser, Converter={StaticResource AddButtonStateConverter}}" Width="55" Command="{Binding ManageProductsViewModel.AddProductCommand, Source={StaticResource Locator}}" CommandParameter="{Binding}"/>
            </StackPanel>
        </DataTemplate>
    </ContentControl.Resources>
    <Grid x:Name="LayoutRoot" Margin="2">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Button x:Name="CloseButton" Content="Close" Click="CloseButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="1" />
        <!- -<Button x:Name="OKButton" Content="OK" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="1" />-->
        <!--<ListBox Height="173" HorizontalAlignment="Center"  Name="listBoxCurrentProducts" VerticalAlignment="Center" Width="483" ItemsSource="{Binding UserProducts}" ItemTemplate="{StaticResource ProductTemplate}" Margin="148,353,148,0" />
        <sdk:AutoCompleteBox Height="28" HorizontalAlignment="Left" Margin="148,12,0,0" Name="autoCompleteBoxProducts" VerticalAlignment="Top" Width="482" Text="{Binding SearchText, Mode=TwoWay}" SelectedItem="{Binding CurrentNewProductForSearch, Mode=TwoWay}" ItemsSource="{Binding AllProducts}" ValueMemberPath="Name" FilterMode="Contains" TabIndex="0">
            <sdk:AutoCompleteBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}"/>
                </DataTemplate>
            </sdk:AutoCompleteBox.ItemTemplate>
        </sdk:AutoCompleteBox>
        <ListBox Height="214" HorizontalAlignment="Left" Margin="148,85,0,0" Name="listBoxSearchResults" VerticalAlignment="Top" Width="482" ItemsSource="{Binding SearchResults}" ItemTemplate="{StaticResource NewProductTemplate}" TabIndex="2" />
        <Button Content="Search" Height="23" HorizontalAlignment="Left" Margin="636,12,0,0" Name="buttonSearch" VerticalAlignment="Top" Width="75" Command="{Binding FindProductsCommand}" TabIndex="1" />
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="148,324,0,0" Name="textBlockYourProducts" Text="Your Products" VerticalAlignment="Top" />
        <TextBlock Height="23" HorizontalAlignment="Left" Margin="148,56,0,0" Name="textBlockSearchResults" Text="Search Results" VerticalAlignment="Top" />
    </Grid>-->
</controls:ChildWindow>